Skip to content

@ W-21372057: Turnstile support in SDK for passwordless login#3695

Closed
kumaravinashcommercecloud wants to merge 6 commits intodevelopfrom
avinash.Turnstile-SDK
Closed

@ W-21372057: Turnstile support in SDK for passwordless login#3695
kumaravinashcommercecloud wants to merge 6 commits intodevelopfrom
avinash.Turnstile-SDK

Conversation

@kumaravinashcommercecloud
Copy link
Contributor

@kumaravinashcommercecloud kumaravinashcommercecloud commented Feb 26, 2026

Overview
Adds Cloudflare Turnstile support for passwordless login in commerce-sdk-react by sending the Turnstile token in authorizePasswordless requests so the BFF/MRT can verify it before forwarding to SLAS.
Changes

  1. packages/commerce-sdk-react/src/auth/index.ts
    Extended AuthorizePasswordlessParams with turnstileResponse?: string.
    When turnstileResponse is present, uses a custom fetch instead of the commerce-sdk-isomorphic helper (which does not send the token).
    Custom fetch sends a POST to the SLAS proxy with turnstileResponse in the body.
    Added slasClientBaseUrl for the custom fetch URL.
    Improved error handling for non-200 responses (empty body, 404 for guest users).
  2. packages/commerce-sdk-react/src/auth/index.test.ts
    Added authorizePasswordless with turnstileResponse uses custom fetch instead of helper.
    Added authorizePasswordless with turnstileResponse throws on non-200 fetch response.
    Adjusted existing error-handling test to use text() instead of json() for the mock response.

Design: https://docs.google.com/document/d/1qV1CVhtWWUGv_Q5On--PjohkNhDInUdUkqN-H4_VgE8/edit?tab=t.ax8cd1bs7a74

Description

Types of Changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Documentation update
  • Breaking change (could cause existing functionality to not work as expected)
  • Other changes (non-breaking changes that does not fit any of the above)

Breaking changes include:

  • Removing a public function or component or prop
  • Adding a required argument to a function
  • Changing the data type of a function parameter or return value
  • Adding a new peer dependency to package.json

Changes

  • (change1)

How to Test-Drive This PR

  • (step1)

Checklists

General

  • Changes are covered by test cases
  • CHANGELOG.md updated with a short description of changes (not required for documentation updates)

Accessibility Compliance

You must check off all items in one of the follow two lists:

  • There are no changes to UI

or...

Localization

  • Changes include a UI text update in the Retail React App (which requires translation)

@kumaravinashcommercecloud kumaravinashcommercecloud requested a review from a team as a code owner February 26, 2026 20:45
@cc-prodsec
Copy link
Collaborator

cc-prodsec commented Feb 26, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

syadupathi-sf
syadupathi-sf previously approved these changes Feb 26, 2026
dannyphan2000
dannyphan2000 previously approved these changes Feb 26, 2026
Copy link
Contributor

@dannyphan2000 dannyphan2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants